//
//  HotViewcontroller.m
//  YSBEmployer
//
//  Created by developer on 2021/12/05.
//  Copyright © 2021 ysb. All rights reserved.
//

#import "HttpClient.h"


@implementation HttpClient

#pragma mark - 修改升级功能,去除请求苹果官网
- (void)updateMethodWithStrive:(BOOL)needStrive andUpdateContent:(NSArray *)updateContentArray andUpdateModel:(UpdateModel *)model {
    
    //获取服务器上应用的最新版本号
    NSString *updateVersion = [YSBCommonTool isBlankString:model.version_no] ? @"" : model.version_no;
    
    NSDictionary *info= [[NSBundle mainBundle] infoDictionary];
    NSString *bundleVersion = [YSBCommonTool isBlankString:info[@"CFBundleShortVersionString"]] ? @"" : info[@"CFBundleShortVersionString"];
    
    NSString *messageStr = [NSString stringWithFormat:@"发现新版本(%@),是否更新?", updateVersion];
    if (updateContentArray.count > 0) {
        NSString *updateStr = @"";
        if (updateContentArray.count > 1) {
            updateStr = [updateContentArray componentsJoinedByString:@" \n"];
        }else{
            updateStr = updateContentArray[0];
        }
        messageStr = updateStr;
    }
    
    if ([updateVersion isEqualToString:bundleVersion]) {
        //            GSToastInCenter(@"当前版本为最新版本无需更新！");
    }
    else {
        if (self.updateAlert == nil) {
            self.updateAlert = [SELUpdateAlert showUpdateAlertWithVersion:updateVersion Description:messageStr isForcingUpdate:needStrive];
            self.updateAlert.hidden = YES;
            //添加弹框界面
            if (self.updateAlert) {
                self.updateAlert.tag = 1;
                [[YSBMSAlertManager shareManager] addAlert:self.updateAlert];
            }
        }
    }
    
}


@end
